﻿namespace ElectronicMall.Domain.Entities.Mall;

/// <summary>
/// 类别
/// </summary>
public class Category : ITreeEntity<int, Category>
    , IOptimisticConcurrencySupported
{
    public virtual int Id { get; set; }
    public virtual string Name { get; set; } = null;

    public virtual string ConcurrencyStamp { get; set; } = null;

    public virtual int? ParentId { get; set; }
    public virtual Category? Parent { get; set; }
    public virtual IList<Category> Children { get; set; } = new List<Category>();

    public virtual int Depth { get; set; }

    public virtual bool IsRoot => ParentId is null;

    public virtual bool IsLeaf => !HasChildren;

    public virtual bool HasChildren { get; set; }

    public virtual string? Path { get; set; }
}